﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CSF.BusinessCore.BLL;
using CSF.Security.Data;
using Ict.DataAccess;

namespace CSF.Security.BLL
{
    internal class RolePermissionBLL : LogCreateLogic<RolePermission>
    {
        internal List<int> GetPermissionIdsByUser(int roleId)
        {
            var q = from p in DataContext.Select<RolePermission>()
                    where p.RoleId == roleId
                    select p.PermissionId;

            return q.ToList();
        }

        internal List<int> GetRoleIdsByPermission(int permissionId)
        {
            var q = from p in DataContext.Select<RolePermission>()
                    where p.PermissionId == permissionId
                    select p.RoleId;
            return q.ToList();
        }
    }
}
